package com.omg.persistence.delegate.lifepoint;

import java.util.List;

import com.ibatis.dao.client.DaoManager;
import com.omg.persistence.dao.lifepoint.DaoConfig;
import com.omg.persistence.dao.lifepoint.entity.LPComment;
import com.omg.persistence.dao.lifepoint.iface.LPCommentDao;

public class LPCommentDelegate {

	private static volatile LPCommentDelegate instance;
	private LPCommentDao lpCommentDao;
	private static final Object synObj = new Object();

	public static LPCommentDelegate getInstance() {
		if (instance == null) {
			instance = new LPCommentDelegate();
		}
		return instance;
	}

	private LPCommentDelegate() {
		synchronized (synObj) {
			DaoManager daoMgr = DaoConfig.getDaoManager();
			this.lpCommentDao = (LPCommentDao) daoMgr
					.getDao(LPCommentDao.class);
		}
	}

	public List<LPComment> getCommentsByActivityId(String activityid) {
		return this.lpCommentDao.getCommentsByActivityId(activityid);
	}

	public LPComment getCommentByCommentId(String commentid) {
		return this.lpCommentDao.getCommentByCommentId(commentid);
	}

	public int addComment(LPComment comment) {
		return this.lpCommentDao.addComment(comment);
	}

	public int updateComment(LPComment comment) {
		return this.lpCommentDao.updateComment(comment);
	}

	public int deleteComment(String commentid) {
		return this.lpCommentDao.deleteComment(commentid);
	}

	public int getCommentTotalByActivityId(String activityid) {
		return this.lpCommentDao.getCommentTotalByActivityId(activityid);
	}

}
